< previous page page_128 next page >

Page 128
Table 6.6 Constants for Each Variant Data Type.
Data TypeVB ConstantVarType() Return Value
EmptyvbEmpty0
NullvbNull1
IntegervbInteger2
LongvbLong3
SinglevbSingle4
DoublevbDouble5
CurrencyvbCurrency6
Date/TimevbDate7
StringvbString8
ObjectvbObject9
ErrorvbError10
BooleanvbBoolean11
VariantvbVariant12 (only used for arrays of variants)
DataObjectvbDataObject13
BytevbByte17
ArrayvbArray8192

If you have a Variant variable, you can perform the following testing to determine its type:
9f31265bb40b592b1929e18a47ab28e5.gif
If VarType(mvntVar) = vbBoolean Then
   ...
End If
In the example, you can see two different command buttons at the bottom of the Variants.frm form. Under each of these buttons is code that sets the value of a module-level variable named mvntVar to a specific data type. The code then uses the VarType() function to return the numeric return value.

 
< previous page page_128 next page >

If you like this book, buy it!